package com.redepronik.negosys.invfac.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.IndexColumn;

/**
 * The persistent class for the bodega database table.
 * 
 */
@Entity
@Table(schema = "invfac", name = "bodega")
@NamedQuery(name = "Bodega.findAll", query = "SELECT b FROM Bodega b")
public class Bodega implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(allocationSize = 1, name = "BODEGA_BODEGAID_GENERATOR", sequenceName = "INVFAC.BODEGA_BODEGAID_SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BODEGA_BODEGAID_GENERATOR")
	@Column(unique = true, nullable = false)
	private Integer bodegaid;

	@Column(nullable = false)
	private Boolean activo;

	@Column(nullable = false, length = 100)
	private String ciudad;

	@Column(length = 100)
	private String direccion;

	@Column(nullable = false, length = 50)
	private String nombre;

	// bi-directional many-to-one association to Bodegaempleadocargo
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega")
	private List<Bodegaempleadocargo> bodegaempleadocargos;

	// bi-directional many-to-one association to Bodegalocal
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega")
	@IndexColumn(name = "orden", base = 1)
	private List<Bodegalocal> bodegalocals;

	// bi-directional many-to-one association to Detalleingreso
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega")
	private List<Detalleingreso> detalleingresos;

	// bi-directional many-to-one association to Kardex
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega")
	private List<Kardex> kardexs;

	// bi-directional many-to-one association to Traspaso
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega1")
	private List<Traspaso> traspasos1;

	// bi-directional many-to-one association to Traspaso
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "bodega2")
	private List<Traspaso> traspasos2;

	public Bodega() {
	}

	public Bodegaempleadocargo addBodegaempleadocargo(
			Bodegaempleadocargo bodegaempleadocargo) {
		getBodegaempleadocargos().add(bodegaempleadocargo);
		bodegaempleadocargo.setBodega(this);

		return bodegaempleadocargo;
	}

	public Bodegalocal addBodegalocal(Bodegalocal bodegalocal) {
		getBodegalocals().add(bodegalocal);
		bodegalocal.setBodega(this);

		return bodegalocal;
	}

	public Detalleingreso addDetalleingreso(Detalleingreso detalleingreso) {
		getDetalleingresos().add(detalleingreso);
		detalleingreso.setBodega(this);

		return detalleingreso;
	}

	public Kardex addKardex(Kardex kardex) {
		getKardexs().add(kardex);
		kardex.setBodega(this);

		return kardex;
	}

	public Traspaso addTraspasos1(Traspaso traspasos1) {
		getTraspasos1().add(traspasos1);
		traspasos1.setBodega1(this);

		return traspasos1;
	}

	public Traspaso addTraspasos2(Traspaso traspasos2) {
		getTraspasos2().add(traspasos2);
		traspasos2.setBodega2(this);

		return traspasos2;
	}

	public Boolean getActivo() {
		return this.activo;
	}

	public List<Bodegaempleadocargo> getBodegaempleadocargos() {
		return this.bodegaempleadocargos;
	}

	public Integer getBodegaid() {
		return this.bodegaid;
	}

	public List<Bodegalocal> getBodegalocals() {
		return this.bodegalocals;
	}

	public String getCiudad() {
		return this.ciudad;
	}

	public List<Detalleingreso> getDetalleingresos() {
		return this.detalleingresos;
	}

	public String getDireccion() {
		return this.direccion;
	}

	public List<Kardex> getKardexs() {
		return this.kardexs;
	}

	public String getNombre() {
		return this.nombre;
	}

	public List<Traspaso> getTraspasos1() {
		return this.traspasos1;
	}

	public List<Traspaso> getTraspasos2() {
		return this.traspasos2;
	}

	public Bodegaempleadocargo removeBodegaempleadocargo(
			Bodegaempleadocargo bodegaempleadocargo) {
		getBodegaempleadocargos().remove(bodegaempleadocargo);
		bodegaempleadocargo.setBodega(null);

		return bodegaempleadocargo;
	}

	public Bodegalocal removeBodegalocal(Bodegalocal bodegalocal) {
		getBodegalocals().remove(bodegalocal);
		bodegalocal.setBodega(null);

		return bodegalocal;
	}

	public Detalleingreso removeDetalleingreso(Detalleingreso detalleingreso) {
		getDetalleingresos().remove(detalleingreso);
		detalleingreso.setBodega(null);

		return detalleingreso;
	}

	public Kardex removeKardex(Kardex kardex) {
		getKardexs().remove(kardex);
		kardex.setBodega(null);

		return kardex;
	}

	public Traspaso removeTraspasos1(Traspaso traspasos1) {
		getTraspasos1().remove(traspasos1);
		traspasos1.setBodega1(null);

		return traspasos1;
	}

	public Traspaso removeTraspasos2(Traspaso traspasos2) {
		getTraspasos2().remove(traspasos2);
		traspasos2.setBodega2(null);

		return traspasos2;
	}

	public void setActivo(Boolean activo) {
		this.activo = activo;
	}

	public void setBodegaempleadocargos(
			List<Bodegaempleadocargo> bodegaempleadocargos) {
		this.bodegaempleadocargos = bodegaempleadocargos;
	}

	public void setBodegaid(Integer bodegaid) {
		this.bodegaid = bodegaid;
	}

	public void setBodegalocals(List<Bodegalocal> bodegalocals) {
		this.bodegalocals = bodegalocals;
	}

	public void setCiudad(String ciudad) {
		this.ciudad = ciudad;
	}

	public void setDetalleingresos(List<Detalleingreso> detalleingresos) {
		this.detalleingresos = detalleingresos;
	}

	public void setDireccion(String direccion) {
		this.direccion = direccion;
	}

	public void setKardexs(List<Kardex> kardexs) {
		this.kardexs = kardexs;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public void setTraspasos1(List<Traspaso> traspasos1) {
		this.traspasos1 = traspasos1;
	}

	public void setTraspasos2(List<Traspaso> traspasos2) {
		this.traspasos2 = traspasos2;
	}

}